﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _017_字段_属性_索引器_常量
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Student stu1= new Student();
            //stu1.Id = 1;
            //stu1.Age = 18;

            //Student stu2= new Student();
            //stu2.Age = 22;
            //stu2.Id = 2;

            //Student.ReportAmount();

            List<Student> stuList = new List<Student>();
            for (int i = 0; i < 100; i++)
            {
                Student student = new Student(1);
                student.Age = 18 + i;
                stuList.Add(student);
            }

            int totalAge = 0;
            int totalScore = 0;

            foreach (var stu in stuList)
            {
                totalAge += stu.Age;
            }
            Student.AverageAge= totalAge/Student.Amount;
            Student.ReportAmount();
            Student.ReportAge();
        }
    }
    public class Student
    {
        public readonly int Id=20;
        public int Age;

        public static int AverageAge;
        public static int AverageScore;
        public static int Amount;

        static Student()
        {
            Student.Amount = 20;
        }

        public Student()
        {
           
        }

        public static void ReportAmount()
        {
            Console.WriteLine(Student.Amount);
        }

        public static void ReportScore()
        {

            Console.WriteLine(Student.AverageScore);
        }

        public static void ReportAge()
        {
            Console.WriteLine(Student.AverageAge);
        }

    }


}
